package cn.iocoder.yudao.module.trade.dal.mysql.receiptinfo;


import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.trade.dal.dataobject.receiptinfo.ReceiptInfoDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.trade.controller.admin.receiptinfo.vo.*;

/**
 * 单据信息 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ReceiptInfoMapper extends BaseMapperX<ReceiptInfoDO> {

    default PageResult<ReceiptInfoDO> selectPage(ReceiptInfoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ReceiptInfoDO>()
                .eqIfPresent(ReceiptInfoDO::getCode, reqVO.getCode())
                .likeIfPresent(ReceiptInfoDO::getName, reqVO.getName())
                .eqIfPresent(ReceiptInfoDO::getRelationType, reqVO.getRelationType())
                .eqIfPresent(ReceiptInfoDO::getOwnerId, reqVO.getOwnerId())
                .betweenIfPresent(ReceiptInfoDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ReceiptInfoDO::getUpdater, reqVO.getUpdater())
                .orderByDesc(ReceiptInfoDO::getId));
    }

}